package com.fy.pojo.enums;

public enum ActivityStatusEnum {
    UPCOMING(0, "即将开始"),
    ONGOING(1, "进行中"),
    ENDED(2, "已结束");

    private final int code;
    private final String desc;

    ActivityStatusEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static ActivityStatusEnum fromCode(int code) {
        for (ActivityStatusEnum status : ActivityStatusEnum.values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("Invalid code: " + code);
    }
}